import { createApp } from 'vue'
import './assets/main.scss'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import 'element-plus/dist/index.css'
import router from '@/router'
import { createPinia } from 'pinia'
// @ts-ignore
import App from './App.vue'
// @ts-ignore 忽略类型检查，因为pinia-persistedstate-plugin包的类型定义存在问题
import { createPersistedState } from 'pinia-persistedstate-plugin'

const app = createApp(App)
const pinia = createPinia()
const persistedstate = createPersistedState({
    enabled: true, //开启持久化
    storage: sessionStorage
})
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}
pinia.use(persistedstate)
app.use(pinia)
app.use(router)
app.mount('#app')
